package com.scqzy.shengchunqiang.sword2offer.day08;

/**
 * @Description: 剑指 Offer 10- I. 斐波那契数列
 * @Author 盛春强
 * @Date 2021/8/15 15:13
 */
public class Fib {
    public int fib(int n) {
        if (n == 0) {
            return 0;
        }
        int a = 0;
        int b = 1;
        for (int i = 2; i < n; i++) {
            int tmp = a;
            a = b;
            b = (tmp + a) % 1000000007;
        }
        return b;
    }
}
